﻿using OA.Model.MyAttribute;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace OA.Model
{
    [Table("Position")]
    public class Position : BaseInfo
    {
        public int Status { get; set; }

        [Display(Name = "岗位名称")]
        [MaxLength(20)]
        [Tag(TagEnum.Text, "required", "岗位名称", 2, 50)]
        public string Name { get; set; }

        

        [Display(Name = "所属部门")]
        [ForeignKey("Department")]
        [Tag(TagEnum.Text, "required", "所属部门", 2, 50)]
        public int DepartmentID { get; set; }

        [Display(Name = "排序")]
        [Tag(TagEnum.Text, "required", "排序", 2, 50)]
        public int Sort { get; set; }

        /// <summary>
        /// 级层
        /// </summary>
        [Display(Name = "级层")]
        [Tag(TagEnum.Select, "required", "级层", 2, 50)]
        public string Level { get; set; }

        [Display(Name = "虚拟岗位")]
        [Tag(TagEnum.Switch,"", "required", "虚拟岗位")]
        public bool IsVirtual { get; set; }

        public virtual Department Department { get; set; }
    }

    public class SimplePosition : SimpleInfo
    {
        
        public string Name { get; set; }

        
        public string DepartmentFullPath { get; set; }

        
        public int DepartmentID { get; set; }
         
        public int Sort { get; set; }

        public static Expression<Func<Position, SimplePosition>> Map = m => new SimplePosition() { ID = m.ID, Name = m.Name, Sort = m.Sort, Status = m.Status, DepartmentID = m.DepartmentID };

    }


    public class EmpPosition
    {
        public int ID { get; set; }

        public string Name { get; set; }

        public int DepartmentID { get; set; }

        public string EmpID { get; set; }

        public virtual Department Department { get; set; }
    }

    public class MyPositions
    {
        public int ID { get; set; }

        public string EmpID { get; set; }

        public int Status { get; set; }

        public string Name { get; set; }

        public int DepartmentID { get; set; }

        public int Sort { get; set; }

        public string DepartmentName { get; set; }
    }

    public class MyPositions2 : MyPositions
    {
        public string StartTime { get; set; }

        public string EndTime { get; set; }



        public string StatusName
        {
            get
            {
                if (this.Status == 1)
                {
                    return "有效";
                }
                else
                {
                    return "无效";
                }
            }
        }
    }

}
